<div id='message-sucess'></div>
<div id="list-midia">
<?php 
echo link_to(
                                        'Adicionar arquivo',
                                        url_for('midia/new?ref='.$reference.'&ref_value='.$ref_value),
                                        array(
                                                'id'        => 'file'
                                        )
                                );

?>
    <ul>
        <?php foreach($midia as $m){ ?>
        <div style="padding:5px; float:left;">
            <li id="show-img-buttons">
            		
                    <?php 
                    
                    	echo link_to(
                                        image_tag("/uploads/thumb/".$m["nm_midia"], array("rel" =>$m["id_midia"])),
                                        image_path("/uploads/".$m["nm_midia"]),
                                        array(
                                                'id'        => 'preview',
                                        		'title'		=> $m['ds_midia'],
                                        		'rel'		=> 'midia_gallery'
                                        )
                                );
                    ?>

                    <div align="right">


                        <?php
                                echo link_to(
                                        ' ',
                                        url_for('midia/edit?id_midia='.$m['id_midia'].'&ref='.$reference.'&ref_value='.$ref_value),
                                        array(
                                                'class'     => 'icoEditar',
                                                'id'        => 'file'
                                        )
                                );
                        ?>
                        <?php
                                echo link_to(
                                        ' ',
                                        url_for('midia/delete?id_midia='.$m['id_midia']),
                                        array(
                                                'class' => 'icoExcluir',
                                                'id'    => 'delete'
                                        )
                                );
                        ?>
                    </div>
            </li>
        </div>
        <?php 	}        ?>
            <div style="clear:both;"></div>
    </ul>
</div>
<script>

    $(function()
    {
        System.modaldata.onClick('file', 'dialog', {width: 600, height: 200, modal:true, title: 'Controle de arquivo'});
        System.formdata.remove('1');
        System.modaldata.openMidiaBox('midia_gallery', true);
    });

</script>
